<template>
  <div>
    <div @click="test">{{mes}}</div>
    <p class="common">使用less</p>
    <p>设置vuex</p>
    <button @click="setData">setData</button>
  </div>
</template>
<style lang="less" rel="stylesheet/less" scoped>

</style>
<script>
  import {axiosGet,axiosPost} from '../assets/api'
  export default {
    data () {
      return {
        mes: '跳转新页面'
      }
    },
    created () {
//      Toast('toast')
      document.title = ''  //标题
      this.getData();
    },
    methods: {
      test () {
        console.log('test');
//        this.$router.push('/demo2')
        this.$router.push({path: 'demo2', query: {plan: 'planes'}})
      },
      // 接口
      getData(){
        axiosGet({
            data: {
              id: 3
            },
            url:'getUserName',
            onSuccess () {
              console.log('success')
            },
            onFailure () {
              console.log('failure')
            }
          }),
          axiosPost({
            data: {
              id: 100
            },
            url:'getSchool',
            onSuccess () {
              console.log('success')
            },
            onFailure () {
              console.log('failure')
            }
          })
      },
      // vuex
      setData () {
        this.setVuex('province', '广西')
        this.setVuex('city', '深圳')
        this.setVuex('town', '南山')
        this.setVuex('money', 20)
      }
    }
  }

</script>
